package com.example.controller;

import com.example.model.OrderInfo;
import com.example.model.OrderInfoP;
import com.example.service.OrderService;
import com.example.service.OrderServiceEureka;
import com.example.service.OrderServiceEurekaLB;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/order")
@RestController
public class OrderController {

    @Autowired
    private OrderService orderService;

    @Autowired
    private OrderServiceEureka orderServiceEureka;

    @Autowired
    private OrderServiceEurekaLB orderServiceEurekaLB;

    @RequestMapping("/{orderId}")
    public OrderInfo getOrderById(@PathVariable("orderId") Integer orderId) {
        return orderService.selectOrderById(orderId);
    }
    @RequestMapping("/orderIdP/{orderId}")
    public OrderInfoP getOrderByIdP(@PathVariable("orderId") Integer orderId) {
        return orderService.selectOrderByIdP(orderId);
    }

    @RequestMapping("/orderIdE/{orderId}")
    public OrderInfoP getOrderByIdE(@PathVariable("orderId") Integer orderId) {
        return orderServiceEureka.selectOrderByIdE(orderId);
    }
    @RequestMapping("/orderIdELB/{orderId}")
    public OrderInfoP getOrderByIdELB(@PathVariable("orderId") Integer orderId) {
        return orderServiceEurekaLB.selectOrderByIdE(orderId);
    }
}
